import { data, RD } from "../../types/cartdemo"

let initialState: data = ['product']

type Iaction = {
    type: string,
    [T: string]: any
}

const productReducer: RD<data, Iaction> = (state = initialState, action) => {
    let { type, payload } = action;
    switch (type) {
        case 'FETCH_PRODUCT':
            return [...payload]
        default:
            return [...state]
    }
}

export default productReducer